package com.koron.order.linepatrol.base.bean.query;

import com.koron.order.linepatrol.base.bean.po.PatrolPo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.util.Date;
import java.util.List;

/**
 * @author jzp
 * @since 2021/11/1
 */
@Data
public class PatrolQuery extends PatrolPo {

    @ApiModelProperty(value = "当前登录人账号list 工作负责人或者工作班成员为当前登录人-工单")
    private List<String> accountList;

    @ApiModelProperty(value = "关键字搜索(编码及标题)")
    private String keyWord;

    private Date startTime;

    @ApiModelProperty(value = "签到状态 工单下任意巡视点签到即为1 ")
    private Integer arriveStatus;

    @ApiModelProperty(value = "巡视设备id")
    private String equipmentId;

    @ApiModelProperty(value = "巡视设备名称")
    private String equipmentName;

    @ApiModelProperty(value = "巡视ids")
    private List<String> ids;

    @ApiModelProperty(value = "计划ids")
    private List<String> planIds;

    @ApiModelProperty(value = "是否超期")
    private Integer overtime;

    /**
     * 有账号参数则不使用patrolUsers
     * @return
     */
    @Override
    public String getPatrolUsers() {
        if (CollectionUtils.isEmpty(accountList)) {
            return super.getPatrolUsers();
        }
        return null;
    }
}
